#! /bin/bash

if [ -n "$1" ]
then
    do_date=$1
else
    do_date=`date -v-1d +%Y-%m-%d`
fi
sql="
insert overwrite table dim.dim_trade_payment
partition(dt='$do_date')
select id, payName
  from ods.ods_trade_payments
 where dt='$do_date';
"
hive -e "$sql"
